
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加员工界面-管理者界面</title>
<!-- 导入semantic的样式 -->
<jsp:include page="../head.jsp">
	<jsp:param value="员工创建" name="title" />
</jsp:include>
<script type="text/javascript">
	function passwordChange(target) {
		var changepasswordEL = document.getElementById("changepassword");
		var inputPasswordEL = document.getElementById("inputPassword");
		changepasswordEL.innerHTML = "";
		ajax({
			url : "employee/changepasswordajax?id=" + $(target).attr("value"),
			callback : function(xhr) {
				var data;
				// 两种方式
				// JSON.parse(xhr.response);
				if (window.JSON) {
					data = JSON.parse(xhr.response);
				} else {
					data = eval("(" + xhr.response + ")");
				}
				if (data) {
					if (confirm("确定重置吗？")) {
						$("#changepassword").css("color","green");
						changepasswordEL.innerText = "重置成功";
						inputPasswordEL.value = 1;
					}else{
						$("#changepassword").css("color","red");
						changepasswordEL.innerText = "放弃重置";
					}
				} else {
					$("#changepassword").css("color","red");
					changepasswordEL.innerText = "未成功重置";
				}
			}
		});
	}
</script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div id="content" class="col-lg-12">
				<div class="dao">
					<a class="section" href="employee?empStatus=1">在职员工</a> <i
						class="right chevron icon divider"></i> <span
						class="active section">修改员工信息</span>
				</div>
				<form class="ui form segment" method="post">
					<div class="two fields">
						<div class="field">
							<label>姓名</label> <input name="name" type="text"
								value="${employee.empName }">
						</div>
						<div class="field">
							<label>性别</label>
							<div class="ui selection dropdown">
								<input name="gender" type="hidden"
									value="${employee.empGender }"> <input name="gender"
									type="hidden" value="${param.gender }">
								<div class="default text">请选择性别</div>
								<i class="dropdown icon"></i>
								<div class="menu">
									<div class="item" data-value="男">男</div>
									<div class="item" data-value="女">女</div>
								</div>
							</div>
						</div>
					</div>

					<div class="field">
						<p>
							<label>密码</label>&nbsp;&nbsp;<a onclick="passwordChange(this)"
								value="${employee.empId }">重置</a>&nbsp;&nbsp;&nbsp;&nbsp;<span
								id="changepassword" style="font-weight: bold;"></span> <input
								name="password" type="hidden" id="inputPassword">

						</p>
					</div>
					<div class="two fields">

						<div class="field">
							<label>部门</label>
							<div class="ui selection dropdown">
								<input name="dept" type="hidden" value="${employee.deptId }">
								<input name="dept" type="hidden" value="${param.dept }">
								<div class="default text">请选择部门</div>
								<i class="dropdown icon"></i>
								<div class="menu">
									<c:forEach items="${deptList }" var="dept">
										<div class="item" data-value="${dept.dept_id }">${dept.dept_name }</div>
									</c:forEach>
								</div>
							</div>
						</div>
						<div class="field">
							<label>职位</label>
							<div class="ui selection dropdown">
								<input name="post" type="hidden" value="${employee.postId }">
								<input name="post" type="hidden" value="${param.post }">
								<div class="default text">请选择职位</div>
								<i class="dropdown icon"></i>
								<div class="menu">
									<c:forEach items="${postList }" var="post">
										<div class="item" data-value="${ post.postId}">${post.postName}</div>
									</c:forEach>
								</div>
							</div>
						</div>
					</div>
					<div class="field">
						<label>电话</label> <input name="tel" type="text"
							value="${employee.empTelphone }">
					</div>
					<div class="field">
						<label>邮箱</label> <input name="email" type="text"
							value="${employee.empEmail }">
					</div>
					<div class="field">
						<label>地址</label> <input name="address" type="text"
							value="${employee.empAddress }">
					</div>
					<button class="ui blue  button">保存</button>${error}

				</form>
			</div>
</body>
</html>